#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int lengthOfLastWord(char* s) {
    int len = strlen(s);
    int i = len - 1;
    int count = 0;
    while (s[i] == ' ')
    {
        i--;
    }
    while (i >= 0 && s[i] != ' ')
    {
        i--;
        count++;
    }
    return count;
}
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* plusOne(int* digits, int digitsSize, int* returnSize) {
    int size = digitsSize;

    int flag = 1;
    for (int a = 0; a < digitsSize; a++) {
        if (digits[a] != 9) {
            flag = 0;
            break;
        }
    }
    if (flag == 0) {
        for (int i = digitsSize - 1; i >= 0; i--) {
            if (digits[i] == 9) digits[i] = 0;
            else {
                digits[i] += 1;
                break;
            }
        }
        *returnSize = digitsSize;
        return digits;
    }
    else {
        int* arr = (int*)malloc(sizeof(int) * (digitsSize + 1));
        arr[0] = 1;
        for (int j = 1; j < digitsSize + 1; j++) {
            arr[j] = 0;
        }
        *returnSize = digitsSize + 1;
        return arr;
    }

}

int main()
{

	return 0;
}